import 'package:flutter/material.dart';
import 'package:jd_shopping/services/ScreenAdaper.dart';

class User extends StatefulWidget {
  @override
  _UserState createState() => _UserState();
}
class _UserState extends State<User> {
  @override
  Widget build(BuildContext context) {
    ScreenAdaper.init(context);
    return Scaffold(
      body: ListView(
        children: <Widget>[
          Container(
            height: ScreenAdaper.height(200),
            width: double.infinity,
            decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage('images/user_bg.jpg'),
                    fit: BoxFit.cover)),
            child: Row(
              children: <Widget>[
                Container(
                  margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
                  child:ClipOval(
                    child: Image.asset(
                      'images/user.png',
                     fit: BoxFit.cover,
                    width: ScreenAdaper.width(100),
                    height: ScreenAdaper.width(100),
                   ),
                  ), 
                ),
                SizedBox(width:20),
                Expanded(
                  flex: 1,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Text("用户名：124124125",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: ScreenAdaper.size(32))),
                       SizedBox(height:10),
                      Text("普通会员",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: ScreenAdaper.size(24))),
                    ],
                  ),
                )
              ],
            ),
          ),
          ListTile(
          leading: Icon(Icons.assignment, color: Colors.red),
          title: Text("全部订单"),
          onTap:(){
             Navigator.pushNamed(context, '/order');
          },
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.payment, color: Colors.green),
          title: Text("待付款"),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.local_car_wash, color: Colors.orange),
          title: Text("待收货"),
        ),
        Container(
            width: double.infinity,
            height: 10,
            color: Color.fromRGBO(242, 242, 242, 0.9)),
        ListTile(
          leading: Icon(Icons.favorite, color: Colors.lightGreen),
          title: Text("我的收藏"),
        ),
        Divider(),
        ListTile(
          leading: Icon(Icons.people, color: Colors.black54),
          title: Text("在线客服"),
        ),
        Divider(),
        ],
      ),
    );
  }
}
